export const mixins = {
    methods: {
        goToDetailPage(item, type) {
            switch (item.docResource ? item.docResource.mimeTypeId : item.mimeTypeId) {
                // 笔记
                // case '22':
                //     if (type == 'view') {
                //         this.$router.push({
                //             path: '/forDetail', query: {
                //                 src: `/seeyon/doc.do?method=knowledgeBrowse&docResId=${item.id}&entranceType=5&v=74e2bd49365f9f8ab8951a37911a420c&docId=${item.id}&from=vueSystem`
                //             }
                //         });
                //     } else if (type == 'edit') {
                //         this.$router.push({
                //             path: '/forDetail', query: {
                //                 src: `/seeyon/doc.do?method=editDoc&docResId=${item.id}&docLibType=1&isUploadFile=false&openFrom=docCenter&from=vueSystem`
                //             }
                //         });
                //     }
                //     break;
                // // 文档
                // case '23':
                //     if (type == 'view') {
                //         this.$router.push({
                //             path: '/forDetail', query: {
                //                 src: `/seeyon/content/content.do?isFullPage=true&moduleId=${item.id}&moduleType=3&viewState=2&rightId=1&contentType=23&officecanPrint=false&officecanSaveLocal=true`
                //             }
                //         });
                //     } else if (type == 'edit') {
                //         this.$router.push({
                //             path: '/forDetail', query: {
                //                 src: `/seeyon/doc.do?method=editDoc&docResId=${item.id}&docLibType=1&isUploadFile=false&openFrom=docCenter&from=vueSystem`
                //             }
                //         });
                //     }
                //     break;
                // 模板或文档
                case '101':
                    if (item.docResource.isLearningDoc) {
                        this.$router.push({ path: '/templateDetails', query: { templateId: item.docResource.keyWords,type:'最近使用'}})
                    } else if (!item.docResource.isLearningDoc) {
                      if (type == 'edit') {
                        this.$router.push({
                          path: '/forDetail', query: {
                            src: `/seeyon/doc.do?method=editDoc&docResId=${item.id}&docLibType=1&isUploadFile=${item.isUploadFile}&openFrom=docCenter&from=vueSystem`
                          }
                        });
                      } else if (type == 'view') {
                        this.$router.push({
                          path: '/forDetail', query: {
                            src: `/seeyon/doc.do?method=knowledgeBrowse&docResId=${item.id}&entranceType=5&v=d452e836ff576efa359a6c1eb47e312c&docId=${item.id}&from=vueSystem`
                          }
                        });
                      }
                    }
                    break;
                case '0':
                    if(type == 'view'){
                      if (item.docResource.content) {
                        const src = JSON.parse(item.docResource.content).img
                        this.$router.push({ path: '/forDetail', query: { src: `${src}` } })
                      }
                    }else if (type == 'edit'){
                      var data =  item.docResource.content
                      var  content = JSON.parse(data);
                      var width = window.screen.width - 30
                      var height = window.screen.height
                      let params = `scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no,width=`+width+ `,height=`+height+ `,left=100,top=100`;
                      var encodedContent = encodeURIComponent(content.content);
                      window.open(`/seeyon/common/mindMapping/index.html?moduleId=${item.docResource.id}&title=${item.docResource.frName}&content=${encodedContent}`, '_blank', params);
                    }
                    break;
                default:
                    if (type == 'edit') {
                        this.$router.push({
                            path: '/forDetail', query: {
                                src: `/seeyon/doc.do?method=editDoc&docResId=${item.id}&docLibType=1&isUploadFile=${item.isUploadFile}&openFrom=docCenter&from=vueSystem`
                            }
                        });
                    } else if (type == 'view') {
                        this.$router.push({
                            path: '/forDetail', query: {
                                src: `/seeyon/doc.do?method=knowledgeBrowse&docResId=${item.id}&entranceType=5&v=d452e836ff576efa359a6c1eb47e312c&docId=${item.id}&from=vueSystem`
                            }
                        });
                    }
            }
        }
    },
}
